﻿/// Write a program that creates an array containing all letters from the alphabet (A-Z). 
/// Read a word from the console and print the index of each of its letters in the array.

using System;

class zad12
{
    static void Main()
    {
        char[] alfabet = new char[52];
        int index = 0;

        for (int i = 65; i <= 65 + 51; i++)
        {
            int current = i;
            
            if (i > 90)
            {
                current = i + 6;
            }

            alfabet[index] = (char)current;
            index++;
        }

        string word = Console.ReadLine();

        foreach (var item in word)
        {
            int indexFound = binarySearch(alfabet, item);
            Console.Write("{0} ", indexFound);
        }

        Console.WriteLine();
    }

    private static int binarySearch(char[] arr, char searchKey)
    {
        int min = 0;
        int max = arr.Length - 1;
        int mid = 0;
        int foundAtIndex = -1;

        while (min <= max)
        {
            mid = min + (max - min) / 2;

            if (searchKey == arr[mid])
            {
                return mid;
            }
            else if (searchKey < arr[mid])
            {
                max = mid - 1;
            }
            else
            {
                min = mid + 1;
            }

        }
        return foundAtIndex;
    }

}

